package com.kylin.common.core.filter;

/**
 * @author wuhao
 * @version 1.0 - 2023/4/23
 */
public class ApiLogThreadLocal {

    private static final ThreadLocal<ApiLogExtend> threadLocal = new ThreadLocal<>();

    /** 设置线程变量 */
    public static void setContext(ApiLogExtend apiLogExtend) {
        threadLocal.set(apiLogExtend);
    }

    /** 获取线程变量 */
    public static ApiLogExtend getContext() {
        ApiLogExtend apiLogExtend = threadLocal.get();
        if(apiLogExtend == null) {
            apiLogExtend = new ApiLogExtend();
        }
        return apiLogExtend;
    }

    /** 移除线程变量 */
    public static void remove() {
        threadLocal.remove();
    }


}
